import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import get from '@dfeidao/atom-web/local/get';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import refresh from '@dfeidao/atom-web/url/refresh';
export default async function a003(fd: IFeidaoAiBrowserComponent) {
	// 编辑保存

	const a = fd.data.node.querySelector<HTMLTextAreaElement>('[data-id="sub_process_des"]').value;
	if (!a) {
		alert('请填写完整数据');
		return;
	}
	const sub_no = get(fd, 'sub_no');
	const _id = get(fd, '_id');
	const sub = fd.data.node.querySelector<HTMLTextAreaElement>('[data-id="sub_process_des"]').value;
	const res = await nodejs<{ code: 1 | 0 }>('processing-set/zj-000006/s001', {
		filter: {
			sub_process_des: sub,
			_id: _id,
			sub_process_no: sub_no
		}
	});
	if (res.code === 1) {
		const n = fd.data.node.querySelector<HTMLDivElement>('[data-id="edit"]');
		set_node_cls(n, 'display-n', true);
		alert("修改成功");
		refresh();
	} else {
		alert("修改失败");
	}
}
